package com.lz.autotest.project.testmanage.autoTest.controller;

import com.lz.autotest.common.entity.ResponseVo;
import com.lz.autotest.project.testmanage.autoTest.entity.TsstAutotestItem;
import com.lz.autotest.project.testmanage.autoTest.entity.TsstAutotestItemVo;
import com.lz.autotest.project.testmanage.autoTest.service.TsstAutotestItemService;
import com.lz.autotest.project.testmanage.infmanage.domain.SstInf;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author: X
 * @date: Created in 2023/6/15 17:02
 * @Description:
 */
@RestController
@RequestMapping(value = "/tsstAutotestItem")
public class TsstAutotestItemController {

    @Resource
    private TsstAutotestItemService tsstAutotestItemService;

    /**
     * 新增
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @RequestMapping("/insert")
    public Object insert(TsstAutotestItem tsstAutotestItem) {
        return tsstAutotestItemService.insert(tsstAutotestItem);
    }

    /**
     * 刪除
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @RequestMapping("/delete")
    public ResponseVo delete(Long id) {
        return tsstAutotestItemService.delete(id);
    }

    /**
     * 更新
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @RequestMapping("/update")
    public ResponseVo update(TsstAutotestItem tsstAutotestItem) {
        return tsstAutotestItemService.update(tsstAutotestItem);
    }

    /**
     * 查询 根据主键 id 查询
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @RequestMapping("/load")
    public Object load(int id) {
        return tsstAutotestItemService.load(id);
    }

    /**
     * 查询 根据主键 menuId 查询
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @RequestMapping("/getMenuDetail.action")
    public ResponseVo getMenuDetail(@RequestParam Map<String, Object> param) {
        List<SstInf> list = tsstAutotestItemService.getMenuDetail(param);
        return ResponseVo.success(list);
    }

    /**
     * 查询 根据主键 menuId 查询
     *
     * @author zip.li
     * @date 2023/06/15
     **/
    @PostMapping("/saveAutoTestItem.action")
    public ResponseVo saveAutoTestItem(@RequestBody TsstAutotestItemVo vo) {
        tsstAutotestItemService.saveAutoTestItem(vo);
        return ResponseVo.success();
    }

}